//
//  SinaStatusViewModel.swift
//  WeiBo01
//
//  Created by mac on 16/1/6.
//  Copyright © 2016年 Han. All rights reserved.
//

import UIKit

class SinaStatusViewModel: NSObject {

    var model: SinaStatusModel?
    
    //定义一个用户url
    var profile_URL: NSURL? {
        
        //get方法
        return NSURL(string: model?.user?.profile_image_url ?? "")
    }
    
    ///reposts_count	int	转发数
    var reposts_string: String?{
        return model?.reposts_count == 0 ? "转发" : "\(model?.reposts_count ?? 0)"
    }
    ///comments_count	int	评论数
    var commnets_string: String?{
        return model?.comments_count == 0 ? "评论" : "\(model?.comments_count ?? 0)"
    }
    ///attitudes_count	int	表态数
    var attitudes_string: String?{
        return model?.attitudes_count == 0 ? "赞" : "\(model?.attitudes_count ?? 0)"
    }
    
    var verifited_Image: UIImage? {
        
        switch model?.user?.verified_level ?? -1 {
            
        case -1:return nil
        case 0: return UIImage(named: "avatar_vip")
        case 2,3,5 : return UIImage(named: "avatar_enterprise_vip")
        case 220: return UIImage(named: "avatar_grassroot")
        default: return nil
            
        }
    }
    
    //会员等级1-6
    var vipLevel_Image: UIImage? {
        
        return UIImage(named: "common_icon_membership_level\(model?.user?.mbrank ?? 0)")
    }
    
    init(statusModel: SinaStatusModel) {
        super.init()
        self.model = statusModel
    }
    
}
